home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / DOC / SCC.ARC / SCC.TXT < prev   
Text File  |  1990-03-02  |  19KB  |  440 lines

  1. The Z8530 SCC driver for the Atari ST and PC Clones
  2.  
  3. By R.E. Janssen, PE1CHL.
  4.  
  5.  
  6. A driver has been written to support a number of Z8530 SCC chips 
  7. connected to an Atari ST computer.  The driver is configurable 
  8. for different hardware configurations, and an example schematic 
  9. supporting up to 7 SCC's (14 channels) has been included.
  10. The driver now also runs on PC Clones, although the interrupt 
  11. handling capabilities of this type of computer limits the maximum 
  12. speed and number of channels to a lower value than on the Atari. 
  13. (depending on the speed of your machine)
  14.  
  15. Each channel may be indepently programmed to support:
  16.  
  17.      - An asynchronous SLIP line
  18.      - An asynchronous interface to a KISS TNC
  19.      - Direct AX.25 (HDLC)
  20.  
  21. The software has been written in such a way that a port to 
  22. another environment where Z8530 SCC's are available should be 
  23. relatively straightforward.  Addresses of the chips are 
  24. completely configurable, and most probably only the first-level 
  25. interrupt handler (written in assembly language) has to be 
  26. adapted to the specific configuration of the interrupt 
  27. acknowledge logic in the system.
  28. The PC version supports a few special types of interface board, 
  29. that use specific IO ports to control certain on-board features 
  30. like MODEMs and interrupt configuration.
  31.  
  32. Initialization and attachment of the channels
  33.  
  34. To use the driver, 2 steps must be performed:
  35.  
  36.      1. Global initialization of the driver
  37.      2. Attachment of each channel, specifying mode and options
  38.  
  39. The global initialization is needed to reset all SCCs and to 
  40. install a common interrupt handler.  Also, the hardware addresses 
  41. of the chips are defined in this step.  In the second step, each 
  42. channel is set up for the intended use.
  43.  
  44.  
  45. 1. Initialization
  46.  
  47. Initialization is performed using the "attach scc init" command, 
  48. using the following syntax:
  49.  
  50.      attach scc <number of chips> init <base address>
  51.           <spacing between chips> <offset to channel A ctrl>
  52.           <offset to channel B ctrl> <offset from ctrl to data>
  53.           <address of INTACK latch>|0 <interrupt number>
  54.           p<PCLK frequency>|r<RTxC frequency>
  55.           [<special interface type> <interface parameter>]
  56.  
  57. To initialize a board with 2 SCCs using my schematic, the 
  58. following command would be used:
  59.  
  60.      attach scc 2 init fffd00 8 3 7 -2 fffd3f 3 p4915200
  61.  
  62. This specifies interrupt number 3, a normally unused interrupt in 
  63. 520ST and 1040ST machines.  In the newer Mega-ST this interrupt 
  64. is used for the Blitter.  In this case, it is possible to use the 
  65. "ring indicator" input of the RS232 interface as an interrupt 
  66. source. It has interrupt number 14.
  67.  
  68. The INTACK latch (write, then read to get the interrupt vector) 
  69. is located at 0xfffd3f.  It is also possible to specify 0 for 
  70. this address.  In that case, INTACK is not used and the driver 
  71. finds the interrupting chip by polling each RR3A register.  This 
  72. allows a more simple hardware design, especially for PCs.
  73.  
  74. The crystal clock is specified as 4.9152 MHz.  Other frequencies 
  75. can be used, and this parameter should be adjusted accordingly.
  76. The clock used for baudrate generation is connected to PCLK. It 
  77. would also be possible to supply a baudrate clock to RTxC, and a 
  78. clock of a different frequency to PCLK (like the processor 
  79. clock).  This option is selected by prefixing the clock frequency 
  80. with an "r" instead of a "p".
  81.  
  82. The "special interface type" and "interface parameter" fields can 
  83. be used to specify some special type of interface board to be 
  84. used.  This requires modification to the driver software.
  85. Currently, the following special types are supported on the PC:
  86.  
  87.      - type 1: EAGLE
  88.      - type 2: PC-100
  89.      - type 4: PRIMUS
  90.      - type 8: DRSI PC*Packet
  91.  
  92. The PC-100 and the PRIMUS accept an interface parameter, that is 
  93. used to control the on-board MODEM.  It must be specified as a 
  94. hexadecimal value to be sent to the output port on the board.
  95. Possible initialisation commands are:
  96.  
  97. EAGLE:    attach scc 1 init 2e8 8 2 0 1 0 2 p3686400 1
  98.  
  99. PC-100:   attach scc 1 init 2e8 16 6 4 1 0 2 p4915200 2 22
  100.  
  101. PRIMUS:   attach scc 1 init 2e8 4 2 0 1 0 2 r2457600 4 02
  102.  
  103. DRSI:     attach scc 1 init 300 16 2 0 1 0 2 p4915200 8
  104.  
  105. When using an AT-type machine (with two 8259 interrupt 
  106. controllers), and using the "interrupt 2" line on the BUS, 
  107. specify interrupt number 9 instead of 2.  This better reflects 
  108. the actual configuration.  The BIOS will attempt the redirection 
  109. of interrupt vector #9 to #2, but it does not completely do the 
  110. job.
  111.  
  112.  
  113. The SCC driver uses the "buffers" feature that pre-allocates a 
  114. number of receiver buffers to be used by the drivers at interrupt 
  115. time.  Be sure to issue a "buffers <n>" command before you attach 
  116. any of the SCC's channels (see below).  The <n> parameter of the 
  117. buffers command specifies the number of buffers to pre-allocate, 
  118. this is a function of the number of channels you will attach, the 
  119. baudrate of the channels, the activity on each of these channels, 
  120. and the time the computer can spend without re-allocating new 
  121. buffers.  A good number of receiver buffers to try is 32. If you 
  122. see a non-zero number in the "Space" column in the SCCSTAT output 
  123. (see below) you can increase this number.  It specifies the 
  124. number of 128-byte buffers that are pre-allocated for the 
  125. receiver buffers of all channels attached. So in this case, 
  126. 4Kbytes are allocated.
  127. It is also possible to set the size of the buffers to be 
  128. allocated, using the 2nd and 3rd argument of the "buffers" 
  129. command.  These set a minimal and maximal size of each buffer.  
  130. The PC version will only allocate buffers of the maximum size 
  131. (and ignores the second argument), but the Atari ST versions 
  132. minimizes the thrashing of the memory freelist by allocating 
  133. buffers between the minimal and maximal size, that can be carved 
  134. out of the freelist without further splitting blocks of memory.
  135. Example: buffers 64 10 128
  136.  
  137. 2. Attach commands
  138.  
  139. When the SCC driver has been initialized, you can attach the 
  140. channels.  This is done using one of 3 forms of the "attach scc" 
  141. command:
  142.  
  143.      attach scc <channel> slip <mtu> <baudrate>
  144.      attach scc <channel> kiss <mtu> <baudrate> <callsign>
  145.      attach scc <channel> ax25 <mtu> <baudrate> <callsign>
  146.  
  147. These will be refferred to as "slip", "kiss" and "ax25" mode.
  148.  
  149. The <channel> parameter specifies which half of which SCC will be 
  150. programmed, as follows:
  151.  
  152.      channel 0: "A" side of first SCC
  153.      channel 1: "B" side of first SCC
  154.      channel 2: "A" side of second SCC
  155.      channel 3: "B" side of second SCC
  156.  
  157. etcetera.   The channel number ranges from 0 to (2 * nchips) - 1, 
  158. where nchips is the number of chips specified in the
  159. "attach scc init" command.
  160.  
  161.  
  162. SLIP mode
  163.  
  164. This can be used for a link to another machine, when the channel 
  165. has an RS232 interface. Example:
  166.  
  167.      attach scc 0 slip sl0 256 9600
  168.  
  169. This attaches the "A" side of the first SCC as interface "sl0", 
  170. with an MTU of 256 and an initial baudrate of 9600.  The baudrate 
  171. can be changed later by:
  172.  
  173.      param sl0 <baudrate>
  174.  
  175. Entering just "param sl0" will display the current baudrate.
  176.  
  177. KISS mode
  178.  
  179. KISS mode can be used to talk to a KISS TNC.  It can also be used 
  180. on an asynchronous link to another computer running NET.
  181. The difference with SLIP is that the interface will be AX.25 
  182. type, and can therefore be used for AX.25 connections.  A 
  183. callsign must be given as a parameter, this will be used for IP 
  184. and NET/ROM purposes on the interface. Example:
  185.  
  186.      attach scc 2 kiss 430 256 4800 pe1chl-7
  187.  
  188. In the example the "A" side of the second SCC will be attached as 
  189. interface "430" using an MTU of 256, a baudrate of 4800 and the 
  190. callsign PE1CHL-7.
  191.  
  192. The command "param 430 <paramnum> <decimal value>" can be used to 
  193. set the parameters of the KISS TNC.  It is not possible to 
  194. display the current settings.
  195.  
  196.  
  197. AX.25 mode
  198.  
  199. This is probably the most interesting mode to use with this 
  200. interface.  It allows AX.25 communication without a TNC.  Only a 
  201. MODEM is needed. Example:
  202.  
  203.      attach sc